package com.coded2.mobileposto.model;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;


/**
 * The persistent class for the posto_combustivel database table.
 * 
 */
@Entity
@Table(name="posto_combustivel")
@NamedQuery(name="PostoCombustivel.findAll", query="SELECT p FROM PostoCombustivel p")
public class PostoCombustivel extends com.coded2.infra.comum.ComumDTO  {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private PostoCombustivelPK id;

	@Column(name="preco")
	private BigDecimal preco;

	//bi-directional many-to-one association to Posto
	@JsonIgnore
	@ManyToOne
	@JoinColumn(name="id_posto", insertable=false, updatable=false)
	private Posto posto;

	//bi-directional many-to-one association to Combustivel
	@ManyToOne
	@JoinColumn(name="id_combustivel", insertable=false,updatable=false)
	private Combustivel combustivel;

	public PostoCombustivel() {
	}

	public PostoCombustivelPK getId() {
		if (id == null) {
			id = new PostoCombustivelPK();
		}
		return id;
	}

	public void setId(PostoCombustivelPK id) {
		this.id = id;
	}

	public BigDecimal getPreco() {
		return this.preco;
	}

	public void setPreco(BigDecimal preco) {
		this.preco = preco;
	}

	public Posto getPosto() {
		return this.posto;
	}

	public void setPosto(Posto posto) {
		this.posto = posto;
	}

	public Combustivel getCombustivel() {
		if (combustivel == null) {
			combustivel = new Combustivel();
			
		}
		return combustivel;
	}

	public void setCombustivel(Combustivel combustivel) {
		this.combustivel = combustivel;
	}

}